package utils;

import java.awt.Image;
import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;

public class JPanelWithBackground extends JPanel {
	
	private static final long serialVersionUID = 1L;
	
	private Image image;
	
	private int x;
	private int y;
	private int width;
	private int height;

	public JPanelWithBackground( Image img, int x, int y, int width, int height ) {
		super();
		
		image = img;
		
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height ;
	}
	
	public void paint( Graphics g ){
		g.drawImage( image, x, y, width, height, this );
		
		setBackground( Color.lightGray );
		
		setOpaque( false );

		super.paint(g);
	}
}